#ifndef EDITER_BAR_H
#define EDITER_BAR_H

#include <QWidget>
#include <QFrame>
#include <QSize>
#include <QDateTime>
#include <QMessageBox>
#include "../unitls/mbutton.h"
#include "../unitls/globalsignalmgr.h"
#include "editer/edit_base.h"
#include "editer/markdown_editer.h"
#include "editer/markdown_editer2.h"
#include "../unitls/unitls.h"

namespace Ui {
class editer_bar;
}
struct edit_struct{
    EditBaseWidget *editer;
    MButton* pb;
};

class editer_bar : public QWidget
{
    Q_OBJECT

public:
    explicit editer_bar(QFrame* i_text_area,QWidget *parent = 0);
    ~editer_bar();
    static const QString& get_current_file();
public slots:
    void MButton_clicked(QString);
    void MButton_DoubleClicked(QString);
    void add_file(QString full_file_path);
    void CloseOneFile(QString);
    void CloseOneFile();
    void CloseAllFile();
    void OnFileRenamed(QString);
    void MResize_event(int w, int h);
    void Save_Signal_file();
    void Save_All_file();
private:
    Ui::editer_bar *ui;
    QFrame* text_area;
    QList<edit_struct*> pb_list;
    int all_width;
    QSize getTextSize(const QString& text) const;
    void update_button_status();
    static QString Current_file;
    int timer_flush_status;
    void timerEvent(QTimerEvent* e);
    bool makesure_savefile_onclose(edit_struct*);
};

#endif // EDITER_BAR_H
